#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,l,r,x,y,z,ans;
template<typename T>void read(T &ss)
{
	char ch;ss=0;ch=getchar();
	for (;!isdigit(ch);ch=getchar());
	for (;isdigit(ch);ch=getchar()) ss=(ss<<1)+(ss<<3)+(ch^48);
	return;
}
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	read(n);read(l);read(r);
	x=(l/n)*n;y=(r/n)*n;z=(r/n+1)*n;
	if (l<=y&&y<=r) ans=n-1;
	else ans=r-y;
	printf("%lld\n",ans);
}

